<template>
	<view>
		<view class="content-wrap" v-if="!toAndFor">
			<view class="t-wrap">
				<view class="score-wrap">
					<text class="text">司机评分：</text>
					<view class="score"><uni-rate disabled class="uni_rate" size="16" margin="4" :value="detail.grade/20"></uni-rate></view>
				</view>
				<view class="date">{{detail.time}}</view>
			</view>
			<view class="cxt">行程评价：{{detail.context}}</view>
		</view>
		
		<view class="content-wrap" v-if="toAndFor">
			<view class="tit">去程评价</view>
			<view class="t-wrap">
				<view class="score-wrap">
					<text class="text">司机评分：</text>
					<view class="score"><uni-rate disabled class="uni_rate" size="16" margin="4" :value="detail.grade/20"></uni-rate></view>
				</view>
				<view class="date">{{detail.time}}</view>
			</view>
			<view class="cxt">行程评价：{{detail.context}}</view>
		</view>
		<view class="content-wrap" v-if="toAndFor">
			<view class="tit">返程评价</view>
			<view class="t-wrap">
				<view class="score-wrap">
					<text class="text">司机评分：</text>
					<view class="score"><uni-rate disabled class="uni_rate" size="16" margin="4" :value="detail.zmap.grade/20"></uni-rate></view>
				</view>
				<view class="date">{{detail.zmap.time}}</view>
			</view>
			<view class="cxt">行程评价：{{detail.zmap.context}}</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				toAndFor: false,
				id: 0, // 订单ID
				detail: {}
			};
		},
		onLoad(opt) {
			this.id = opt && opt.id
			this.getDetail()
		},
		methods: {
			getDetail() {
				this.$http.get(this.$api.getEvaluationDetail, {orderNo: this.id}).then(res => {
					if (res.code === 200) {
						this.detail = res.data
						this.toAndFor = res.data && res.data.zmap
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
.content-wrap {
	display: flex;
	flex-direction: column;
	background-color: #fff;
	padding: 30rpx;
	font-size: 26rpx;
	margin-bottom: 20rpx;
	.tit {
		font-size: 30rpx;
		color: $blue;
		margin-bottom: 20rpx;
	}
	.t-wrap {
		display: flex;
		justify-content: space-between;
		align-items: center;
		.score-wrap {
			font-size: 28rpx;
			display: flex;
			align-items: center;
			.text {
				margin-right: 20rpx;
				color: #666;
			}
		}
		.date {
			font-size: 24rpx;
			color: #999;
		}
	}
	.cxt {
		margin-top: 20rpx;
		line-height: 40rpx;
		font-weight: 500;
	}
}
</style>
